<?php
require_once 'sisco.php';

/**
 * @package sisco
 * @subpackage controller
 */
class Categorias_protoweb extends Sisco
{

	public function __construct() 
	{
		parent::__construct();
	}

    protected function createPrepare(&$data)
    {
        
    
        // Collections of has one relationships
    
        // Collections of has many to many relationships
    
    }

    protected function assignCreatePost(&$data)
    {
        if ( array_key_exists('nombre', $this->input->post()) ) $data['categoria']->nombre = $this->input->post('nombre');
    
        // has one relationships
        
        // Many to many
    
        return true;
    }

    protected function afterCreateSuccess(&$data)
    {
        
        
    }

    protected function revertOnCreateError(&$data)
    {
        
        
    }

    protected function updatePrepare(&$data)
    {
        
    
        // Collections of has one relationships
        
        // Collections of has many to many relationships
    
    }

    protected function assignUpdatePost(&$data)
    {
        if ( array_key_exists('nombre',$this->input->post()) ) $data['categoria']->nombre = $this->input->post('nombre');
    
        // has one relationships
    
        // Many to many
        
    
        return true;
    }

    protected function afterUpdateSuccess(&$data)
    {
        
        
    }

    protected function revertOnUpdateError(&$data)
    {
        
        
    }

    protected function afterDeleteSuccess(&$data)
    {
        
        
    }

    protected function readPrepare(&$data)
    {
        
        
    }

    protected function saveEntity(&$data,$saveHasOne=true,$saveHasMany=true)
    {
        // saving attributes
        if ( ! $data['categoria']->save()) {
            return false;
        }

        // saving one raleted
        if ($saveHasOne) {
            $relationships = array();
            
            if ( ! $data['categoria']->save($relationships)) {
                return false;
            }
        }

        // saving many to many relationships
        if ($saveHasMany) {
                    }
        return true;
    }

        
    
} // class Categorias

/* End of file categorias_protoweb.php */
/* Location: ./application/controllers/categorias_protoweb.php */